from rich.console import Console
from rich.table import Table

console = Console()

# 创建表格对象
table = Table(title="Sample Table")

# 添加表头
table.add_column("ID", justify="right", style="cyan", no_wrap=True)
table.add_column("Name", style="magenta")
table.add_column("Age", justify="right", style="green")

# 添加表格行
table.add_row("1", "Alice", "25")
table.add_row("2", "Bob", "30")
table.add_row("3", "Charlie", "22")

# 显示表格
console.print(table)